package cn.exrick.xboot.modules.base.controller.common;

import cn.exrick.xboot.common.utils.ResultUtil;
import cn.exrick.xboot.common.vo.Result;
import cn.exrick.xboot.modules.base.service.WeChatAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "微信接口")
@RequestMapping("/xboot/auth/wechat")
public class WeChatLoginController {

    @Autowired
    private WeChatAuthService weChatAuthService;

    @GetMapping("/login")
    @ApiOperation(value = "微信登录")
    public Result<String> wechatLogin(@RequestParam String code) {
        return ResultUtil.data(weChatAuthService.loginWithWeChat(code));
    }
}
